import {mapState} from 'vuex'
export default{
  onShow(){
    this.showTotal()
  },
  computed:{
    ...mapState('m_cart',['cart','total']),
      // ...mapGetters('m_cart',['total'])
  },
  watch:{
    total:{
      handler(){
        this.showTotal()
      },
      immediate:true
    }
  },
  methods:{
    showTotal(){
  if(this.total!==0){
    console.log('aaaaa',this.total)
    uni.setTabBarBadge({
      text:this.total+'',
      index:2
    })
  }
    }
  },
  onLoad(){
    this.$store._mutations['m_cart/total1'][0]()
  }
}